import axios from './axios'
const queryString = require('querystring')
async function post (path, params) {
  const data = await find(path, params)
  return data
}
function find (path, params) {
  return new Promise((resolve, reject) => {
    const param = queryString.stringify(params)
    axios.post(`/${path}`, param).then((res) => {
      resolve(res)
    }).catch((err) => {
      reject(err)
    })
  })
}

export default post
